﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;


namespace Pong
{
    public class puck
    {
         private Texture2D _puck;
         private Texture2D _PuckGlow;
         private int _size;
        private Vector2 _location;
        private Vector2 _velocity;

         public int GetSize
         {
             get { return _size; }
             set { _size = value; }
         }
         public Vector2 Location
         {
             get { return _location; }
             set { _location = value; }
         }
         public Vector2 Velocity
         {
             get { return _velocity; }
             set { _velocity = value; }
         }
         public Rectangle GetRectangle()
         {
             return new Rectangle((int)_location.X - (_size / 2), (int)_location.Y - (_size / 2), _size, _size);
         }

         public puck( string texture, ContentManager Content)
         {
             _PuckGlow = Content.Load<Texture2D>("Puck_Glow");
             _puck = Content.Load<Texture2D>(texture);
             this._size = _puck.Width;
         }

        public void Update()
        {
            _velocity = new Vector2(_velocity.X-(_velocity.X * .02f),(float)_velocity.Y - (_velocity.Y * .02f));
            
            _location += _velocity;
        }
        
        public void Draw(SpriteBatch sprite)
        {
            sprite.Draw(_puck, _location, null, Color.White, 0.0f, new Vector2(_puck.Width / 2, _puck.Height / 2), 1.0f, SpriteEffects.None, 0);

        }
        public void DrawGlow(SpriteBatch Sprite)
        {
            Sprite.Draw(_PuckGlow, _location, null, Color.Red, 0.0f, new Vector2(_PuckGlow.Width / 2, _PuckGlow.Height / 2),1.0f, SpriteEffects.None, 0);
        }
    }
}
